﻿@model OrderModel

<div class="panel-group">
    <div class="panel panel-default">
        <div class="panel-body">
            <div class="form-group">
                <div class="col-md-3">
                    @Html.SDFLabelFor(model => model.BillingAddress)
                </div>
                <div class="col-md-9">
                    <table class="table table-hover table-bordered" style="max-width: 400px;">
                        @if (Model.BillingAddress.FirstNameEnabled || Model.BillingAddress.LastNameEnabled)
                        {
                            <tr>
                                <td>
                                    @T("Admin.Orders.Address.FullName")
                                </td>
                                <td>
                                    @Model.BillingAddress.FirstName @Model.BillingAddress.LastName
                                </td>
                            </tr>
                        }
                        @if (Model.BillingAddress.EmailEnabled)
                        {
                            <tr>
                                <td>
                                    @T("Admin.Orders.Address.Email")
                                </td>
                                <td>
                                    @Model.BillingAddress.Email
                                </td>
                            </tr>
                        }
                        @if (Model.BillingAddress.PhoneEnabled)
                        {
                            <tr>
                                <td>
                                    @T("Admin.Orders.Address.Phone")
                                </td>
                                <td>
                                    @Model.BillingAddress.PhoneNumber
                                </td>
                            </tr>
                        }
                        @if (Model.BillingAddress.FaxEnabled)
                        {
                            <tr>
                                <td>
                                    @T("Admin.Orders.Address.Fax")
                                </td>
                                <td>
                                    @Model.BillingAddress.FaxNumber
                                </td>
                            </tr>
                        }
                        @if (Model.BillingAddress.CompanyEnabled)
                        {
                            <tr>
                                <td>
                                    @T("Admin.Orders.Address.Company")
                                </td>
                                <td>
                                    @Model.BillingAddress.Company
                                </td>
                            </tr>
                        }
                        @if (Model.BillingAddress.StreetAddressEnabled)
                        {
                            <tr>
                                <td>
                                    @T("Admin.Orders.Address.Address1")
                                </td>
                                <td>
                                    @Model.BillingAddress.Address1
                                </td>
                            </tr>
                        }
                        @if (Model.BillingAddress.StreetAddress2Enabled)
                        {
                            <tr>
                                <td>
                                    @T("Admin.Orders.Address.Address2")
                                </td>
                                <td>
                                    @Model.BillingAddress.Address2
                                </td>
                            </tr>
                        }
                        @if (Model.BillingAddress.CityEnabled)
                        {
                            <tr>
                                <td>
                                    @T("Admin.Orders.Address.City")
                                </td>
                                <td>
                                    @Model.BillingAddress.City
                                </td>
                            </tr>
                        }
                        @if (Model.BillingAddress.StateProvinceEnabled)
                        {
                            <tr>
                                <td>
                                    @T("Admin.Orders.Address.StateProvince")
                                </td>
                                <td>
                                    @Model.BillingAddress.StateProvinceName
                                </td>
                            </tr>
                        }
                        @if (Model.BillingAddress.ZipPostalCodeEnabled)
                        {
                            <tr>
                                <td>
                                    @T("Admin.Orders.Address.ZipPostalCode")
                                </td>
                                <td>
                                    @Model.BillingAddress.ZipPostalCode
                                </td>
                            </tr>
                        }
                        @if (Model.BillingAddress.CountryEnabled)
                        {
                            <tr>
                                <td>
                                    @T("Admin.Orders.Address.Country")
                                </td>
                                <td>
                                    @Model.BillingAddress.CountryName
                                </td>
                            </tr>
                        }
                        @if (!String.IsNullOrEmpty(Model.BillingAddress.FormattedCustomAddressAttributes))
                        {
                            <tr>
                                <td colspan="2">
                                    @Html.Raw(Model.BillingAddress.FormattedCustomAddressAttributes)
                                </td>
                            </tr>
                        }

                    </table>
                </div>
            </div>

            @if (!Model.IsLoggedInAsVendor)
            {
                <div class="form-group">
                    <div class="col-md-9 col-md-offset-3">
                        <a href="@Url.Action("AddressEdit", new {addressId = Model.BillingAddress.Id, orderId = Model.Id})" class="btn btn-primary">@T("Admin.Common.Edit")</a>
                    </div>
                </div>
            }
        </div>
    </div>
</div>